<?php

$info=json_decode($this->input->raw_input_stream,true);				
if($this->goods_model->getbytbid($info["id"],$shop["id"])) die("exist");


$product=array(
    "catid"=>$shop["id"],
    "tbid"=>$info["id"],
    "name"=>$info["name"],
    "thumb"=>serialize($info["img"]),
    "source"=>"Alibaba",
    "source_url"=>$info["url"],
    "price"=>$info["price"],
    "sales"=>0,
    "extra"=>trim($info["desc"]),
    "moq"=>"",
    //"desc"=>preg_replace("/<a[^>]*href=[^>]*>|<\/[^a]*a[^>]*>/i","",$info["prop"]),
    "desc"=>trim($info["prop"]),
);
if(isset($info["moq"]) && $info["moq"])
{
    $product["moq"]=$info["moq"];
}

$prop=array();
if($info["sku"]){
    $prop["vv"]=$info["sku"];
}
$product["option"]=serialize($prop);

if($this->goods_model->create($product)){
    die("ok");
}else{
    die("error");
}
